package com.hcb.fragment;

import com.hcb.app911.MainActivity;
import com.hcb.app911.R;
import com.hcb.dto.CustomerDTO;
import com.hcb.model.utils.CustomerModel;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.Spinner;

public class MyDetailsFragment extends Fragment {
	EditText edusername, edemail, edphonenumber, edAge, edGender;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_my_detail,
				container, false);
		((MainActivity)this.getActivity()).getImgDetail().setImageResource(R.drawable.mydetailf);
		((MainActivity)this.getActivity()).getImgHome().setImageResource(R.drawable.icon);
		edusername = (EditText) rootView.findViewById(R.id.edusername);
		edemail = (EditText) rootView.findViewById(R.id.edemail);
		edphonenumber = (EditText) rootView.findViewById(R.id.edphonenumber);
		edAge = (EditText) rootView.findViewById(R.id.edAge);
		edGender = (EditText) rootView.findViewById(R.id.edGender);

		CustomerModel model = CustomerModel.getInstance();
		CustomerDTO dto = model.getCustomer(getActivity());
		edusername.setText(dto.getName());
		edemail.setText(dto.getEmail_address());
		edphonenumber.setText(dto.getMobile_number());
		edAge.setText(dto.getAge());
		edGender.setText(dto.getSex());
		return rootView;
	}
}
